package org.example.trader.service.storage;

import org.apache.ibatis.annotations.*;
import org.example.trader.data.entity.TraderEntity;

@Mapper
public interface TraderEntityMapper {

    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert("insert into t_trader_entity(account, password, display_name, state) value(#{account}, #{password}, #{displayName}, #{state}, #{createTimestamp})")
    public Integer insertTraderEntity(TraderEntity traderEntity);

    @Select("select * from t_trader_entity where account = #{account} and password = #{password}")
    public TraderEntity selectByAccountAndPassword(@Param("account") String account, @Param("password")String password);

    @Select("select * from t_trader_entity where id = #{id}")
    public TraderEntity selectTraderEntityById(Long id);

    @Update("update t_trader_entity set display_name = #{displayName} where id = #{id}")
    public Integer updateTraderEntity(TraderEntity traderEntity);

}
